package com.tarena.demo.luban.all.main.service.impl;

import com.tarena.demo.luban.all.main.mapper.CartMapper;
import com.tarena.demo.luban.all.main.service.ICartService;
import com.tarena.demo.luban.protocol.cart.dos.CartDO;
import com.tarena.demo.luban.protocol.cart.param.CartAddParam;
import com.tarena.demo.luban.protocol.cart.param.CartDeleteParam;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CartServiceImpl implements ICartService {

    @Autowired
    CartMapper cartMapper;

    @Override
    public void addCart(CartAddParam cartAddParam) {
        CartDO cartDO = new CartDO();
        BeanUtils.copyProperties(cartAddParam,cartDO);
        cartMapper.insert(cartDO);
    }

    @Override
    public void deleteCart(CartDeleteParam cartDeleteParam) {
        CartDO cartDO = new CartDO();
        BeanUtils.copyProperties(cartDeleteParam,cartDO);
        cartMapper.delete(cartDO);
    }
}
